var domContainer = document.querySelector('.container');
var itemHeight = 30;
var durationTime = 500;
domContainer.addEventListener('click', function (e) {
  if ('H2' === e.target.tagName) {
    openMenu(e.target.nextElementSibling);
  }
});

function openMenu(menudom) {
  var config = {
    startValue: 0,
    endValue: itemHeight * menudom.children.length,
    duration: durationTime,
    onChangeListener: function (e) {
      menudom.style.height = e + 'px';
    },
    onendListener: function () {
      console.log('end');
    },
  };
  createAnimate(config);
}

function closeMenu(menudom) {
    var config = {
      startValue: itemHeight * menudom.children.length,
      endValue: ,
      duration: durationTime,
      onChangeListener: function (e) {
        menudom.style.height = e + 'px';
      },
      onendListener: function () {
        console.log('end');
      },
    };
    createAnimate(config);
  }
